class SimpleMenu {
    String name
    String description
    
    Integer sequence = 1
    Integer type = 1
    
    SimpleMenu parent
    static belongsTo =[parent:SimpleMenu ]
    static hasMany = [childrens:SimpleMenu]
    static mapping = {   
       parent:[column:'parent_Id',lazy:"true",cascade:"none"]
       children joinTable:[name:'children', key:'parent_Id', column:'Id',lazy:"true",inverse:"false",cascade:"none"]   
    }   
    static constraints = {
        name(maxLength:50,blank:false)
        description(maxLength:100,blank:false)
        parent(nullable:true)
        sequence(min:0)
        type(min:0)
    }
    
    String toString() {
//        "${this.name}(ID=${this.id},description=${this.description})"
		"${this.name}"
    }
}  
